package com.aretias.jkholdings.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.aretias.jkholdings.model.Board;
import com.aretias.jkholdings.model.BoardParam;
import com.aretias.jkholdings.model.BoardReply;
import com.aretias.jkholdings.model.BoardReplyParam;
import com.aretias.jkholdings.repository.BoardRepository;

@Service
public class BoardServiceImpl implements BoardService{
	
	@Autowired
	private BoardRepository boardRepository;
	
	@Override
	public List<Board> getBoardList(BoardParam param) {
		return boardRepository.selectBoardList(param);
	}
	
	@Override
	public int getBoardListCount(BoardParam param) {
		return boardRepository.selectBoardListCount(param);
	}

	@Transactional
	@Override
	public int addBoard(BoardParam param) {
		return boardRepository.insertBoard(param);
	}
	
	@Transactional
	@Override
	public void modifyBoard(BoardParam param) {
		boardRepository.updateBoard(param);
	}
	
	@Transactional
	@Override
	public void removeBoard(BoardParam param){
		boardRepository.deleteBoard(param);
	}
	
	@Override
	public Board getBoard(BoardParam param) {
		return boardRepository.selectBoard(param);
	}
	
	@Override
	public BoardReply getBoardReply(BoardReplyParam param){
		return boardRepository.selectBoardReply(param);
	}
	
	@Override
	public List<BoardReply> getBoardReplyList(BoardReplyParam param){
		return boardRepository.selectBoardReplyList(param);
	}
	
	@Override
	public int getBoardReplyListCount(BoardReplyParam param){
		return boardRepository.selectBoardReplyListCount(param);
	}
	
	@Transactional
	@Override
	public void addBoardReply(BoardReplyParam param){
		boardRepository.insertBoardReply(param);
	}
	
	@Transactional
	@Override
	public void modifyBoardReply(BoardReplyParam param){
		boardRepository.updateBoardReply(param);
	}
	
	@Transactional
	@Override
	public void removeBoardReply(BoardReplyParam param){
		boardRepository.deleteBoardReply(param);
	}

}
